<template>
  <div class="searchbox">
    <div class="topbox">
      <div class="lefticon">
        <i class="el-icon-search"></i>
        <span>筛选查询</span>
      </div>
      <!-- 筛选框 -->
      <div class="rightbox">
        <div class="statusfilter" @click="puilFillterBox">
          <i :class="isIconShow ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"></i>
          <span v-text="isIconShow ? '收起筛选' : '展开筛选 '"></span>
        </div>
        <div class="searchresult">
          <el-button-group>
            <slot name="btn"> </slot>
          </el-button-group>
        </div>
      </div>
    </div>
    <div class="filterbox" :style="'height:' + filtBoxWidth">
      <div class="filter-left-box">
        <slot name="left"> </slot>
      </div>
      <div class="filter-cont-box">
        <slot name="cont"> </slot>
      </div>
      <div class="filter-right-box">
        <slot name="right"></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isIconShow: false
    }
  },
  methods: {
    // 修改筛选栏状态
    puilFillterBox() {
      this.isIconShow = !this.isIconShow
    }
  },
  computed: {
    filtBoxWidth() {
      if (this.isIconShow) {
        return '50px'
      } else {
        return '0'
      }
    }
  }
}
</script>

<style lang="less" scoped>
.searchbox {
  .topbox {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f3f3f3;
    padding: 8px 15px;
    .lefticon {
      i {
        font-size: 18px;
        vertical-align: middle;
        margin-right: 3px;
      }
    }
    .rightbox {
      display: flex;
      align-items: center;
      .el-button {
        padding: 5px;
        font-size: 12px;
      }
      .statusfilter {
        margin-right: 9px;
        i {
          margin-right: 3px;
        }
      }
    }
  }
  .filterbox {
    overflow: hidden;
    display: flex;
    align-items: center;
    transition: 0.3s;
    background: #ccc;
    .filter-left-box,
    .filter-cont-box,
    .filter-right-box {
      display: flex;
      align-items: center;
      margin-left: 30px;
      width: 300px;
      .el-input,
      .el-select {
        font-size: 12px;
        width: 75%;
      }
      .title {
        margin-right: 10px;
      }
    }
  }
}
</style>
